home *** CD-ROM | disk | FTP | other *** search
/ Graphics & Sound Program…ng Techniques for the Mac / Graphics and Sound Programming Techniques for the Mac.iso / M&T Graphics & Sound Examples / Symantec Versions / C09 App-QuickTime / P01 Film Edit / MovieUtilities.c < prev    next >
Encoding:
Text File  |  1995-08-05  |  2.5 KB  |  94 lines  |  [TEXT/KAHL]

  1. //____________________________________________________________
  2. //    MovieUtilities.c
  3. //
  4. //    Copyright © Dan Parks Sydow, 1995
  5. //    From the book:
  6. //    "Graphics and Sound Programming Techniques for the Mac",
  7. //    M&T Books, 1995
  8.  
  9.  
  10. //____________________________________________________________
  11.  
  12. #include <Movies.h>
  13.   
  14. #include "Defines.h" 
  15. #include "DataTypes.h"
  16. #include "Globals.h"
  17. #include "WindRecordAccess.h"
  18. #include "MovieUtilities.h"
  19.  
  20.  
  21. //____________________________________________________________
  22.  
  23. Boolean  UpdateAllOpenMovies( EventRecord theEvent )
  24. {
  25.    int              i;
  26.    WindowPtr        theWindow;
  27.    WindowPeek       theWindPeek;
  28.    MovieController  theController;
  29.    Boolean          eventWasHandled;
  30.    
  31.    theWindow = FrontWindow();
  32.    
  33.    for (i = 0; i < gWindowCount; i++)
  34.    {
  35.       if ( GetWindowType( theWindow ) == kMovieWindowType )
  36.       {
  37.          theController = GetWindowController( theWindow );
  38.          eventWasHandled = MCIsPlayerEvent( theController, &theEvent);
  39.          if ( eventWasHandled == 1 )
  40.             return ( true );
  41.       }
  42.       theWindPeek = ((WindowPeek)theWindow)->nextWindow;
  43.       theWindow = (WindowPtr)theWindPeek;
  44.    }
  45.    return ( false );
  46. }
  47.  
  48.  
  49. //____________________________________________________________
  50.  
  51. void  CloseMovieAndFile( WindowPtr theWindow )
  52. {
  53.    MovieController  theController;
  54.    Movie            theMovie;
  55.    short            theFileRefNum;
  56.    
  57.    theFileRefNum = GetWindowFileReference( theWindow );
  58.    CloseMovieFile( theFileRefNum );
  59.  
  60.    theController = GetWindowController( theWindow );
  61.    DisposeMovieController( theController );   
  62.  
  63.    theMovie = GetWindowMovie( theWindow );
  64.    DisposeMovie( theMovie );
  65.    
  66.    DisposeWindow( theWindow );
  67.    
  68.    --gWindowCount;
  69. }
  70.  
  71.  
  72. //____________________________________________________________
  73.  
  74. pascal  Boolean  SizeChangeMCActionFilter( MovieController theController, 
  75.                                            short           theAction,
  76.                                            void           *theParams,
  77.                                            long            theRefCon )
  78. {
  79.    Rect   theBoundsRect;
  80.    short  theWidth;
  81.    short  theHeight;
  82.    
  83.    switch ( theAction )
  84.    {
  85.       case mcActionControllerSizeChanged:
  86.          MCGetControllerBoundsRect( theController, &theBoundsRect );
  87.          theWidth  = theBoundsRect.right - theBoundsRect.left;
  88.          theHeight = theBoundsRect.bottom - theBoundsRect.top;
  89.          SizeWindow( (WindowPtr)theRefCon, theWidth, theHeight, true );
  90.          break;
  91.    }
  92.    return false;
  93. }
  94.